package com.bjdd.jdy.entity;

import com.bjdd.jdy.Constant;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yukai on 2017/2/15.
 */

public class User {

    /**
     * carrierId : 2
     * userName : 13655945593
     * password : 123456
     * realName : null
     * mobile : 13655945593
     * money : null
     * photo : null
     * status : 0
     * lastLoginTime : null
     * createTime : 1491881290000
     */

    private String carrierId;
    private String userName;
    private String password;
    private String realName;
    private String mobile;
    private BigDecimal money;
    private String photo;
    private int status;
    private String lastLoginTime;
    private String createTime;
    private int materialStatus;//审核状态 0 未审核 1正在审核 2 审核成功 3 审核失败
    private int examStatus;//考试状态 0 未开始 1通过第一阶段 2通过第二阶段 3通过考试
    private boolean workStatus;//开工或者收工
    public static User objectFromData(String str) {

        return new Gson().fromJson(str, User.class);
    }

    public static List<User> arrayUserFromData(String str) {

        Type listType = new TypeToken<ArrayList<User>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public String getCarrierId() {
        return carrierId;
    }

    public void setCarrierId(String carrierId) {
        this.carrierId = carrierId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public String getPhoto() {
        String url = Constant.IMG_URL + photo;
        return url;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Object getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(String lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public boolean isWorkStatus() {
        return workStatus;
    }

    public void setWorkStatus(boolean workStatus) {
        this.workStatus = workStatus;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public int getMaterialStatus() {
        return materialStatus;
    }

    public void setMaterialStatus(int materialStatus) {
        this.materialStatus = materialStatus;
    }

    public int getExamStatus() {
        return examStatus;
    }

    public void setExamStatus(int examStatus) {
        this.examStatus = examStatus;
    }
}
